home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / System / Swatch / Development / swatch 1.2 / swatch INIT / init.main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-10-15  |  1.3 KB  |  88 lines  |  [TEXT/KAHL]

  1. /**
  2.  
  3.     init.main.c
  4.     Copyright (c) 1990, joe holt
  5.  
  6.  **/
  7.  
  8.  
  9. /**-----------------------------------------------------------------------------
  10.  **
  11.  ** Headers
  12.  **
  13.  **/
  14.  
  15. #include "init.resources.h"
  16. /*#include "init.types.h"*/
  17.  
  18. #include "drvr.csControl.h"
  19. #include "drvr.csOpen.h"
  20. #include "init.main.h"
  21.  
  22.  
  23. /**-----------------------------------------------------------------------------
  24.  **
  25.  ** Private Functions
  26.  **
  27.  **/
  28.  
  29. Handle GetAndDetachResource( OSType type, int16 id );
  30. void DisposValidHandle( Handle h );
  31.  
  32. OSErr main( CntrlParam *cpb, DCtlPtr dce, int16 n );
  33.  
  34.  
  35. /*******************************************************************************
  36.  **
  37.  **    Public Functions
  38.  **
  39.  **/
  40.  
  41. OSErr main( CntrlParam *cpb, DCtlPtr dce, int16 n )
  42. {
  43.     OSErr ret;
  44.  
  45.     asm {
  46.             move.l    A4, D0
  47.             _StripAddress
  48.             move.l    D0, A4
  49.     }
  50.     ret = noErr;
  51.     switch ( n ) {
  52.     case 0:
  53.         ret = csOpen( cpb, dce );
  54.         break;
  55.  
  56.     case 2:
  57.         ret = csControl( cpb, dce );
  58.         break;
  59.  
  60.     case 4:
  61.         ret = closeErr;        /* don't ever close */
  62.         break;
  63.  
  64.     default:
  65.         break;
  66.     }
  67.     return ret;    
  68. }
  69.  
  70.  
  71. #if 0
  72. Handle GetAndDetachResource( OSType type, int16 id )
  73. {
  74.     Handle        res;
  75.  
  76.     if (!(res = Get1Resource(type, id)) || HandleZone(res) != SysZone)
  77.         return (NULL);
  78.     DetachResource(res);
  79.     return (res);
  80. }
  81.  
  82.  
  83. void DisposValidHandle( Handle h )
  84. {
  85.     if (h)
  86.         DisposHandle(h);
  87. }
  88. #endif